package com.qf.ems.service.Impl;


import com.github.pagehelper.PageHelper;
import com.qf.ems.entity.Emp;

import com.qf.ems.entity.Page;
import com.qf.ems.mapper.EmpMapper;
import com.qf.ems.service.EmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
/*2021/9/16*/public class EmpServiceImpl implements EmpService {

    @Autowired
    EmpMapper empMapper;
    //调用dao的查询所有员工信息方法，返回给Controller
    @Override
    public List<Emp> selectAllEmp(Page page) {
        PageHelper.startPage(page.getPageNum(), page.getPageSize());
        List<Emp> empList=empMapper.selectAll();
        return empList;
    }

    @Override
    public Long totalCount() {
        return null;
    }


    @Override
    public Integer deleteOneInfo(Integer empId) {
        return  empMapper.deleteEmp(empId);
    }

    @Override
    public Emp selectOneEmp(Integer empId) {
        return  empMapper.selectOneInfo(empId);
    }

    @Override
    public Integer updateEmpInfo(Emp emp) {
        return  empMapper.updateEmp(emp);
    }

    @Override
    public Integer addEmp(Emp emp) {
        Integer integer = empMapper.insertEmp(emp);
            int i=10/0;
        return   integer;
    }


}
